{% extends "@CoreBundle/layout/main.html.twig" %}

{% block page_title %}首页{% endblock %}

{% block page %}
    <!-- Small boxes (Stat box) -->
  <div class="row">
      <div class="col-sm-6 col-sm-6 col-md-6 col-lg-3">
            <div class="card">
              <div class="card-body">
                <div class="flex-box">
                  <div>
                    <p class="text-muted m-b-10">今日收入</p>
                    <h2>¥{{ todayIncome }}</h2>
                  </div>
                  <span class="img-avatar img-avatar-48 bg-purple"><i class="mdi mdi-account fs-22"></i></span>
                </div>
              </div>
            </div>
      </div>
      <!-- ./col -->
      <div class="col-sm-6 col-sm-6 col-md-6 col-lg-3">
            <div class="card">
              <div class="card-body">
                <div class="flex-box">
                  <div>
                    <p class="text-muted m-b-10">今日注册用户</p>
                    <h2>¥{{ todayRegUserCount }}</h2>
                  </div>
                  <span class="img-avatar img-avatar-48 bg-primary"><i class="mdi mdi-account fs-22"></i></span>
                </div>
              </div>
            </div>
      </div>
      <div class="col-sm-6 col-sm-6 col-md-6 col-lg-3">
        <div class="card">
          <div class="card-body">
            <div class="flex-box">
              <div>
                <p class="text-muted m-b-10">今日订单数</p>
                <h2>{{ todayOrderCount }}</h2>
              </div>
              <span class="img-avatar img-avatar-48 bg-danger"><i class="mdi mdi-shopping fs-22"></i></span>
            </div>
          </div>
        </div>
      </div>
      <!-- ./col -->
      <!-- ./col -->
      <div class="col-sm-6 col-sm-6 col-md-6 col-lg-3">
            <div class="card">
              <div class="card-body">
                <div class="flex-box">
                  <div>
                    <p class="text-muted m-b-10">总用户数</p>
                    <h2>{{ totalRegUserCount }}</h2>
                  </div>
                  <span class="img-avatar img-avatar-48 bg-primary"><i class="mdi mdi-account fs-22"></i></span>
                </div>
              </div>
            </div>
        <!-- small box -->
      </div>
      <!-- ./col -->
    </div>
  <!-- /.row -->
  <div class="row">
    <div class="col-md-12">
      <div class="card">
        <!-- /.card-header -->
        <div class="card-body">
          <div class="table-responsive">
          <h6 class="card-title">最近订单</h6>
            <table class="table m-0">
              <thead>
              <tr>
                <th>订单号</th>
                <th>商品名称</th>
                <th>金额</th>
                <th>订单状态</th>
                <th>下单时间</th>
              </tr>
              </thead>
              {% if lastOrder %}
              <tbody>
              {% for k, v in lastOrder %}
                <tr>
                  <td>{{ v['orderNo'] }}</td>
                  <td>{{ v['goodName'] }}</td>
                  <td>{{ v['orderAmount'] }}</td>
                  <td>
                    {% if v['orderStatus'] == 2 %}
                    <span class="badge badge-success">{{ v['orderStatusView'] }}</span>
                    {% else %}
                      <span class="badge badge-info">{{ v['orderStatusView'] }}</span>
                    {% endif %}
                  </td>
                  <td>
                    {{ v['createdAt'] }}
                  </td>
                </tr>
              {% endfor %}
              </tbody>
              {% endif %}
            </table>
          </div>
          <!-- /.table-responsive -->
        </div>
        <!-- /.card-body -->
        <div class="card-footer clearfix">
          {% if is_authorized('admin_mall_order_index') %}
          <a href="{{ path('admin_mall_order_index') }}" class="btn btn-sm btn-secondary float-right">查看所有订单</a>
          {% endif %}
        </div>
        <!-- /.card-footer -->
      </div>
    </div>
  </div>
{% endblock %}
